import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '用户等级',
    align:"center",
    dataIndex: 'goodsLevel'
   },
   {
    title: '有效期（天数）',
    align:"center",
    dataIndex: 'periodDay'
   },
   {
    title: '领养等级要求',
    align:"center",
    dataIndex: 'adoptionLevel'
   },
   {
    title: '总数量',
    align:"center",
    dataIndex: 'totalNum'
   },
   {
    title: '库存量',
    align:"center",
    dataIndex: 'inventoryNum'
   },
   {
    title: '每小时收益',
    align:"center",
    dataIndex: 'profitRatio'
   },
   {
    title: '商品描述',
    align:"center",
    dataIndex: 'goodsInfo'
   },
   {
    title: '基地编号',
    align:"center",
    dataIndex: 'baseCode'
   },
   {
    title: '基地名称',
    align:"center",
    dataIndex: 'baseName'
   },
   {
    title: '图片',
    align:"center",
    dataIndex: 'goodsImg'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '用户等级',
    field: 'goodsLevel',
    component: 'InputNumber',
  },
  {
    label: '有效期（天数）',
    field: 'periodDay',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入有效期（天数）!'},
          ];
     },
  },
  {
    label: '领养等级要求',
    field: 'adoptionLevel',
    component: 'InputNumber',
  },
  {
    label: '总数量',
    field: 'totalNum',
    component: 'InputNumber',
  },
  {
    label: '库存量',
    field: 'inventoryNum',
    component: 'InputNumber',
  },
  {
    label: '每小时收益',
    field: 'profitRatio',
    component: 'InputNumber',
  },
  {
    label: '商品描述',
    field: 'goodsInfo',
    component: 'InputTextArea',
  },
  {
    label: '基地编号',
    field: 'baseCode',
    component: 'Input',
  },
  {
    label: '基地名称',
    field: 'baseName',
    component: 'Input',
  },
  {
    label: '图片',
    field: 'goodsImg',
    component: 'JImageUpload',
    helpMessage: '最多上传1张图片',
    componentProps: {
      fileMax : 1,
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '名称',order: 0,view: 'text', type: 'string',},
  goodsLevel: {title: '用户等级',order: 1,view: 'number', type: 'number',},
  periodDay: {title: '有效期（天数）',order: 2,view: 'number', type: 'number',},
  adoptionLevel: {title: '领养等级要求',order: 3,view: 'number', type: 'number',},
  totalNum: {title: '总数量',order: 4,view: 'number', type: 'number',},
  inventoryNum: {title: '库存量',order: 5,view: 'number', type: 'number',},
  profitRatio: {title: '每小时收益',order: 6,view: 'number', type: 'number',},
  goodsInfo: {title: '商品描述',order: 7,view: 'textarea', type: 'string',},
  baseCode: {title: '基地编号',order: 8,view: 'text', type: 'string',},
  baseName: {title: '基地名称',order: 9,view: 'text', type: 'string',},
  goodsImg: {title: '图片',order: 10,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}